package com.csproj.dispatch.service.dto;


import com.csproj.dispatch.util.DateJsonDeserializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.ZonedDateTimeSerializer;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A DTO for the Logistics entity.
 */
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class LogisticsDTO implements Serializable {

    private String id;
    private String customCode;
    private String containerId;//集装箱主键
    private String containerCode;//集装箱编号

    private String logisticsCode;

    private String importer;
//    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8", locale = "zh")
    private ZonedDateTime importTime;

    private String pod;

    private String loadingport;

    private String domesticdestination;

    private String transportcompany;

    private String transporttool;

    private String transportCode;

    private Boolean deletedFlag;

    private String deleterUserId;
//    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime deletionTime;
//    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime lastModificationTime;

    private String lastModifierUserId;
//    @JsonDeserialize(using = DateJsonDeserializer.class)
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8", locale = "zh")
    private ZonedDateTime creationTime;

    private String creatorUserId;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getContainerId() {
        return containerId;
    }

    public void setContainerId(String containerId) {
        this.containerId = containerId;
    }

    public String getCustomCode() {
        return customCode;
    }

    public void setCustomCode(String customCode) {
        this.customCode = customCode;
    }

    public String getContainerCode() {
        return containerCode;
    }

    public void setContainerCode(String containerCode) {
        this.containerCode = containerCode;
    }

    public String getLogisticsCode() {
        return logisticsCode;
    }

    public void setLogisticsCode(String logisticsCode) {
        this.logisticsCode = logisticsCode;
    }

    public String getImporter() {
        return importer;
    }

    public void setImporter(String importer) {
        this.importer = importer;
    }

    public ZonedDateTime getImportTime() {
        return importTime;
    }

    public void setImportTime(ZonedDateTime importTime) {
        this.importTime = importTime;
    }

    public String getPod() {
        return pod;
    }

    public void setPod(String pod) {
        this.pod = pod;
    }

    public String getLoadingport() {
        return loadingport;
    }

    public void setLoadingport(String loadingport) {
        this.loadingport = loadingport;
    }

    public String getDomesticdestination() {
        return domesticdestination;
    }

    public void setDomesticdestination(String domesticdestination) {
        this.domesticdestination = domesticdestination;
    }

    public String getTransportcompany() {
        return transportcompany;
    }

    public void setTransportcompany(String transportcompany) {
        this.transportcompany = transportcompany;
    }

    public String getTransporttool() {
        return transporttool;
    }

    public void setTransporttool(String transporttool) {
        this.transporttool = transporttool;
    }

    public String getTransportCode() {
        return transportCode;
    }

    public void setTransportCode(String transportCode) {
        this.transportCode = transportCode;
    }

    public Boolean isDeletedFlag() {
        return deletedFlag;
    }

    public void setDeletedFlag(Boolean deletedFlag) {
        this.deletedFlag = deletedFlag;
    }

    public String getDeleterUserId() {
        return deleterUserId;
    }

    public void setDeleterUserId(String deleterUserId) {
        this.deleterUserId = deleterUserId;
    }

    public ZonedDateTime getDeletionTime() {
        return deletionTime;
    }

    public void setDeletionTime(ZonedDateTime deletionTime) {
        this.deletionTime = deletionTime;
    }

    public ZonedDateTime getLastModificationTime() {
        return lastModificationTime;
    }

    public void setLastModificationTime(ZonedDateTime lastModificationTime) {
        this.lastModificationTime = lastModificationTime;
    }

    public String getLastModifierUserId() {
        return lastModifierUserId;
    }

    public void setLastModifierUserId(String lastModifierUserId) {
        this.lastModifierUserId = lastModifierUserId;
    }

    public ZonedDateTime getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(ZonedDateTime creationTime) {
        this.creationTime = creationTime;
    }

    public String getCreatorUserId() {
        return creatorUserId;
    }

    public void setCreatorUserId(String creatorUserId) {
        this.creatorUserId = creatorUserId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        LogisticsDTO logisticsDTO = (LogisticsDTO) o;
        if(logisticsDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), logisticsDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "LogisticsDTO{" +
            "id=" + getId() +
            ", containerId='" + getContainerId() + "'" +
            ", customCode='" + getCustomCode() + "'" +
            ", containerCode='" + getContainerCode() + "'" +
            ", logisticsCode='" + getLogisticsCode() + "'" +
            ", importer='" + getImporter() + "'" +
            ", importTime='" + getImportTime() + "'" +
            ", pod='" + getPod() + "'" +
            ", loadingport='" + getLoadingport() + "'" +
            ", domesticdestination='" + getDomesticdestination() + "'" +
            ", transportcompany='" + getTransportcompany() + "'" +
            ", transporttool='" + getTransporttool() + "'" +
            ", transportCode='" + getTransportCode() + "'" +
            ", deletedFlag='" + isDeletedFlag() + "'" +
            ", deleterUserId='" + getDeleterUserId() + "'" +
            ", deletionTime='" + getDeletionTime() + "'" +
            ", lastModificationTime='" + getLastModificationTime() + "'" +
            ", lastModifierUserId='" + getLastModifierUserId() + "'" +
            ", creationTime='" + getCreationTime() + "'" +
            ", creatorUserId='" + getCreatorUserId() + "'" +
            "}";
    }
}
